{include file="public/header" /}
<link rel="stylesheet" href="/static/admin/addons/builder/css/base.css" media="all">
<style>
	.layui-form-item {
		margin-bottom: 15px !important;
		clear: both;
		*zoom: 1;
	}
	.goBack{
		float: left;cursor:pointer;
		font-weight: bold;
		font-size: 15px;
	}
	.center{
		font-weight: bold;
		font-size: 15px;
	}
</style>
<body>
<form action="{:url('save')}" class="layui-form" id="form">
	<div class="layui-fluid layui-anim layui-anim-downbit">
		<div class="layui-card">
			<div class="layui-card-body" style="padding: 15px;">
				<div class="layui-row" style="padding-top: 8px;">
					<div class="layui-form-item">
						<label class="layui-form-label">配置标识</label>
						<div class="layui-input-block">
							<input type="text" name="name" lay-verify="required" placeholder="用于config函数调用，只能使用英文且不能重复" class="layui-input"/>
						</div>
					</div>
					<div class="layui-form-item">
						<label class="layui-form-label">配置标题</label>
						<div class="layui-input-block">
							<input type="text" name="title" lay-verify="required" placeholder="用于后台显示的配置标题" class="layui-input" />
						</div>
					</div>
					<div class="layui-form-item">
						<label class="layui-form-label">配置描述</label>
						<div class="layui-input-block">
							<input type="text" name="remark" lay-verify="required" placeholder="配置描述" class="layui-input" />
						</div>
					</div>
					<div class="layui-form-item">
						<label class="layui-form-label">配置类型</label>
						<div class="layui-input-inline">
							<select name="type" lay-filter="call_type">
								<option value="">请选择</option>
								<?php foreach(get_config_type() as $k=>$v){?>
								{if $k > 0}
								<option value="<?php echo $k; ?>"><?php echo $v; ?></option>
								{/if}
								<?php }?>
							</select>
						</div>
						<span style="float:left;margin-top: 10px;">如选择“区间”类型,value值将被解析成逗号拼接格式(例如100,1000)</span>
					</div>
					<div class="layui-form-item" id="suffix">
						<label class="layui-form-label">后缀</label>
						<div class="layui-input-inline">
							<select name="suffix">
								<option value="">请选择</option>
								<?php foreach(get_suffix() as $k=>$v){?>
								<option value="<?php echo $v; ?>"><?php echo $v; ?></option>
								<?php }?>
							</select>
						</div>
						<span style="float:left;margin-top: 10px;">显示在配置值的后边，仅支持字符、数字、区间类型，例如:200 元(如不需要请忽略)</span>
					</div>
					<div class="layui-form-item" id="time_format">
						<label class="layui-form-label">时间格式</label>
						<div class="layui-input-inline">
							<select name="format">
								<option value="">请选择</option>
								<?php foreach(get_layDate_type() as $k=>$v){?>
								<option value="<?php echo $k; ?>"><?php echo $v; ?></option>
								<?php }?>
							</select>
						</div>
						<span style="float:left;margin-top: 10px;" >具体样式参考:<a target="_blank" href="https://www.layui.com/demo/laydate.html">https://www.layui.com/demo/laydate.html</a></span>
					</div>
					<div class="layui-form-item">
						<label class="layui-form-label">配置分组</label>
						<div class="layui-input-inline">
							<select name="group">
								<option value="0">请选择</option>
								<?php foreach(get_config_group() as $k=>$v){?>
								<option value="<?php echo $k; ?>"><?php echo $v; ?></option>
								<?php }?>
							</select>
						</div>
					</div>
					<div class="layui-form-item">
						<label class="layui-form-label">配置值</label>
						<div class="layui-input-block">
							<input type="text" name="value" placeholder="用于config函数调用显示的值如果是日期型需添加后在编辑日期" class="layui-input" />
						</div>
					</div>
					<div class="layui-form-item layui-form-text">
						<label class="layui-form-label">配置项</label>
						<div class="layui-input-block">
							<textarea name="extra" placeholder="如果是枚举型 需要配置该项" class="layui-textarea"></textarea>
						</div>
					</div>
					<div class="layui-form-item">
						<label class="layui-form-label">排序</label>
						<div class="layui-input-block">
							<input type="number" name="sort" placeholder="用于显示的顺序" value="0" class="layui-input"/>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
	{include file="public/submit" /}
</form>
</body>
{include file="public/footer" /}
<script>
	//添加配置页面，监听日期配置
	layui.form.on('select(call_type)', function (obj) {
		if (obj.value == '7') {
			$("#time_format").css('display', 'block');
		} else {
			$("#time_format").css('display', 'none');
		}
	});
</script>
</html>